const routerData =  {
    'view_articles': {
        path:'articleList',
        name:'admin_articleList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/articleManage/articleList.vue'),
    },
    'view_comment': {
        path:'commentList',
        name:'admin_commentList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/articleManage/commentList.vue'),
    },
    'add_articles':{
        path:'articleEdit',
        name:'admin_articleAdd',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/articleManage/articleEdit.vue'),
    },
    'change_articles':{
        path:'articleEdit/:articleId',
        name:'admin_articleEdit',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/articleManage/articleEdit.vue'),
    },
    'view_tags':{
        path:'articleTag',
        name:'admin_articleTag',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/articleManage/articleTag.vue'),
    },
    'view_group':{
        path:'groupList',
        name:'admin_groupList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/groupManage/groupList.vue'),
    },
    'add_group': {
        path:'groupAdd',
        name:'admin_groupAdd',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/groupManage/groupEdit.vue'),
    },
    'change_group': {
        path:'groupEdit/:groupId',
        name:'admin_groupEdit',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/groupManage/groupEdit.vue'),
    },
    'view_users': {
        path:'userList',
        name:'admin_userList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/userManage/userList.vue'),
    },
    'change_users': {
        path:'userEdit/:user_id',
        name:'admin_userEdit',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/userManage/userEdit.vue'),
    },
    'view_banners': {
        path:'bannerList',
        name:'admin_bannerList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/bannerManage/bannerList.vue'),
    },
    'add_banners':  {
        path:'bannerAdd',
        name:'admin_bannerAdd',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/bannerManage/bannerEdit.vue'),
    },
    'change_banners': {
        path:'bannerEdit/:banner_id',
        name:'admin_bannerEdit',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/bannerManage/bannerEdit.vue'),
    },
    'view_info':{
        path:'infoList',
        name:'admin_infoList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/infoManage/infoList.vue'),
    },
    'add_info': {
        path:'infoAdd',
        name:'admin_infoAdd',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/infoManage/infoEdit.vue'),
    },
    'change_info':{
        path:'infoEdit/:info_id',
        name:'admin_infoEdit',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/infoManage/infoEdit.vue'),
    },
    'view_adminmenu': {
        path:'navmenuList',
        name:'admin_navmenulist',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/navMenuManage/navMenuList.vue'),
    },
    'view_version': {
        path:'versionList',
        name:'admin_versionList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/versionManage/versionList.vue'),
    },
    'view_flowchart':  {
        path:'flowList',
        name:'admin_flowList',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/flowManage/flowList.vue'),
    },
    'view_flowstep':  {
        path:'flowTree/:flowId',
        name:'admin_flowTree',
        meta:{
            checked:true
        },
        component:()=>import('@/views/admin/flowManage/flowTree.vue'),
    },
}

export default function (permission){
    let routes = []
    permission.forEach(v=>{
        let val = routerData[v]
        if(val){
            routes.push(val)
        }
    })
    return {
        path:'/admin',
        name:'admin',
        component:()=>import('@/views/admin/admin/admin.vue'),
        children:[
            {
                path:'',
                name:'admin_index',
                meta:{
                    checked:true
                },
                component:()=>import('@/views/admin/index/index.vue'),
            },
            ...routes,
        ]
    }
}
